<?php

namespace App\Modules\Apicrzs\Http\Controllers\Intake;

use App\Modules\Apicrzs\Http\Controllers\BaseApicrzsController;
use App\Modules\Apicrzs\Services\Water\DeviceService;
use App\Modules\Apicrzs\Services\Water\PayRechargeService;
use Illuminate\Http\Request;

class PayRechargeController extends BaseApicrzsController
{
    public function __construct(PayRechargeService $service)
    {
        $this->service = $service;
    }

    /**
     *  充值记录
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function lists(Request $request)
    {
        $result = $this->service->getLists($request->all());
        return $this->sendApiSuccess($result, $this->service->getError());
    }
    /**
     * 套餐 充值
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function createRechargeOrder(Request $request)
    {
        $result = $this->service->createRechargeOrder($request->all());
        if ($result){
            return $this->sendApiSuccess($result, $this->service->getError());
        }else{
            return $this->sendApiError($this->service->getError());
        }
    }


}
